package com.myidis.servlet;

import java.util.ArrayList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.myidis.entity.QuotaDataItem;
import com.myidis.mapper.QuotaDataItemMapper;

@Service
public class QuotaDataItemServlet {
	@Autowired
	private QuotaDataItemMapper quotaDataItemMapper;
	
	public ArrayList<QuotaDataItem> all() {
		return quotaDataItemMapper.all();
	}
	
	public QuotaDataItem getOne(int id) {
		return quotaDataItemMapper.getOne(id);
	}
	
	public int insert(QuotaDataItem obj) {
		return quotaDataItemMapper.insert(obj);
	}
	
	public int insertAll(ArrayList<QuotaDataItem> objs) {
		int count = 0;
		for (QuotaDataItem obj: objs) {
			count += quotaDataItemMapper.insert(obj);
		}
		return count;
	}
	
	public int update(QuotaDataItem quotaDataItem) {
		return quotaDataItemMapper.update(quotaDataItem);
	}
	
	public int delete(int id) {
		return quotaDataItemMapper.delete(id);
	}
	
	public int deleteAll(int[] ids) {
		int count = 0;
		for(int id: ids)
			count += quotaDataItemMapper.delete(id);
		return count;
	}	
}
